﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Hp.Vertica.Migration.SqlServer
{
    public abstract class SqlDataTypeWithLength : SqlDataType
    {
        public SqlDataTypeWithLength() { }

        public SqlDataTypeWithLength(Int32 size)
        {
            this.Size = size;
        }

        public override int Size
        {
            get
            {
                return base.Size;
            }
            set
            {

                base.Size = value < this.MinSize ? this.MinSize : (value > this.MaxSize ? MaxSize : value);

            }
        }

        public override string ToString()
        {
            return this.Name + "(" + this.Size + ")";
        }

        public abstract int MinSize { get; }

        public abstract int MaxSize { get; }

    }
}
